import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layout/Layout.vue'

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard',
        name: 'Dashboard',
        component: () => import('@/views/Dashboard.vue'),
        meta: { title: 'Dashboard', icon: 'DataAnalysis' }
      },
      {
        path: 'donors',
        name: 'Donors',
        component: () => import('@/views/donors/DonorList.vue'),
        meta: { title: 'Donor Management', icon: 'User' }
      },
      {
        path: 'donors/:id',
        name: 'DonorDetail',
        component: () => import('@/views/donors/DonorDetail.vue'),
        meta: { title: 'Donor Details', hidden: true }
      },
      {
        path: 'vials',
        name: 'Vials',
        component: () => import('@/views/vials/VialList.vue'),
        meta: { title: 'Vial Management', icon: 'Box' }
      },
      {
        path: 'recipients',
        name: 'Recipients',
        component: () => import('@/views/recipients/RecipientList.vue'),
        meta: { title: 'Recipient Management', icon: 'UserFilled' }
      },
      {
        path: 'orders',
        name: 'Orders',
        component: () => import('@/views/orders/OrderList.vue'),
        meta: { title: 'Order Management', icon: 'ShoppingCart' }
      },
      {
        path: 'orders/create',
        name: 'CreateOrder',
        component: () => import('@/views/orders/CreateOrder.vue'),
        meta: { title: 'Create Order', hidden: true }
      },
      {
        path: 'offspring',
        name: 'Offspring',
        component: () => import('@/views/offspring/OffspringList.vue'),
        meta: { title: 'Offspring Tracking', icon: 'Management' }
      },
      {
        path: 'clinics',
        name: 'Clinics',
        component: () => import('@/views/clinics/ClinicList.vue'),
        meta: { title: 'Partner Clinics', icon: 'OfficeBuilding' }
      },
      {
        path: 'statistics',
        name: 'Statistics',
        component: () => import('@/views/Statistics.vue'),
        meta: { title: 'Statistics', icon: 'TrendCharts' }
      },
      {
        path: 'logs',
        name: 'Logs',
        component: () => import('@/views/Logs.vue'),
        meta: { title: 'Operation Logs', icon: 'Document' }
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router

